#override("title")
SpringWind - 场地列表
#end
#override("css")
<link href="#springUrl('/static/css/plugins/bootstrap-table/bootstrap-table.min.css')" rel="stylesheet">
<link href="#springUrl('/static/js/plugins/umeditor/themes/default/css/umeditor.css')" type="text/css" rel="stylesheet">
<link href="#springUrl('/static/js/plugins/bootstrap-fileinput/css/fileinput.css')" type="text/css" rel="stylesheet">
#end
#override("breadcrumb")
<li><a>评分系统</a></li><li class="active"><strong>场地列表</strong></li><li class="active"><strong id="province">$!{province}</strong></li><li class="active"><strong id="city">$!{city}</strong></li>
#end
#override("content")
<div class="row">
    <form enctype="multipart/form-data"  >
        <div class="file-loading">
            <input  name="siteFile" id="siteFile" class="file" type="file" multiple data-min-file-count="1">
        </div>
    </form>
</div>

#end
#override("js")
<script src="#springUrl('/static/js/plugins/bootstrap-table/bootstrap-table.min.js')"></script>
<script src="#springUrl('/static/js/plugins/bootstrap-table/bootstrap-table-mobile.min.js')"></script>
<script src="#springUrl('/static/js/plugins/bootstrap-table/locale/bootstrap-table-zh-CN.min.js')"></script>
<script src="#springUrl('/static/plugins/layer-v2.2/layer/layer.js')"></script>
<script src="#springUrl('/static/js/common.js')"></script>
<script src="#springUrl('/static/plugins/nice-validator-0.8.1/jquery.validator.js')"></script>
<script type="text/javascript" charset="utf-8" src="#springUrl('/static/js/plugins/umeditor/umeditor.config.js')"></script>
<script type="text/javascript" charset="utf-8" src="#springUrl('/static/js/plugins/umeditor/umeditor.js')"></script>
<script type="text/javascript" src="#springUrl('/static/js/plugins/umeditor/lang/zh-cn/zh-cn.js')"></script>
<script type="text/javascript" src="#springUrl('/static/js/plugins/bootstrap-fileinput/js/fileinput.js')"></script>
<script type="text/javascript" src="#springUrl('/static/js/plugins/bootstrap-fileinput/js/locales/zh.js')"></script>
<script type="text/javascript">
     
    !function(){
        $('#description').val('$!{site.description}');
        $("input[name='locationType'][value='$!{site.locationType}']").attr("checked",true);
    }();

    $("#myForm").validator({
        valid: function(form){
            var me = this;
            // 提交表单之前，hold住表单，防止重复提交
            me.holdSubmit();
            $.ajax({
                url: "#springUrl('/site/save')",
                dataType: "json",
                data:$(form).serialize(),
                type: "POST",
                success: function(data){
                    if(data.success && data.data){
                        parent.layer.alert("保存成功",function(){
                            parent.layer.closeAll();
                        });
                        me.holdSubmit(false);
                    } else {
                        //失败，提交表单成功后，释放hold，如果不释放hold，就变成了只能提交一次的表单
                        me.holdSubmit(false);
                    }
                }
            });
        }
    });

    $("#siteFile").fileinput({
        theme: 'zh',
        language: 'zh',
        enctype: 'multipart/form-data',
        uploadAsync: true, //默认异步上传
        uploadUrl: "#springUrl('/siteFile/upLoad')", // you must set a valid URL here else you will get an error
        allowedFileExtensions: ['doc', 'docx', 'pdf'],
        overwriteInitial: false,
        maxFileSize: 1000,
        maxFilesNum: 10,
        //allowedFileTypes: ['image', 'video', 'flash'],
        slugCallback: function (filename) {
            return filename.replace('(', '_').replace(']', '_');
        }
    });
</script>
#end
#extends("/common/framework.html")
